<?php
//VideoFlow - Joomla Multimedia System for Facebook//
/**
* @ Version 1.1.3 
* @ Copyright (C) 2008 - 2010 Kirungi Fred Fideri at http://www.fidsoft.com
* @ VideoFlow is free software
* @ Visit http://www.fidsoft.com for support
* @ Kirungi Fred Fideri and Fidsoft accept no responsibility arising from use of this software 
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
**/

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$doc =& JFactory::getDocument();
$fupload = JURI::root().'components/com_videoflow/utilities/js/fupload.js';
$doc->addScript($fupload);
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_videoflow'.DS.'tables');
global $vparams;
$xparams = &JComponentHelper::getParams( 'com_videoflow' );
$vparams = JTable::getInstance('config', 'Table');    
$vparams ->load(1);
$vparams-> logo = JURI::root().'components/com_videoflow/players/logo.png';
$vparams->showstars = 1;
$vparams->stardesc = '({num_votes} #VF_VOTES, #VF_AVERAGE {num_average} #VF_OUTOF)'; // Leave empty for no desc
$vparams->rating_access 		= 'all'; 
$vparams->rating_periodical	= '0'; 
$vparams->only_registered		= '0'; 
$vparams->nsecid = '';
$vparams->nfront = 1;
$vparams->contactuser = 1;
$vparams->fbpwidth = 600;
$vparams->fbpheight = 338;
$vparams->metapwidth = 352;
$vparams->metapheight = 264;
$vparams->playerwidth = $xparams->get('playerwidth', $vparams->playerwidth);
$vparams->playerheight = $xparams->get('playerheight', $vparams->playerheight);
if ($vparams->prostatus) {
    $db = & JFactory::getDBO();
    $query = 'SELECT name FROM #__vflow_plugins WHERE type = "jtools"';
    $db->setQuery($query);
    $vparams->xmode = $db->loadResult();
   } else {
    $vparams->xmode = 0;
   }        

        $c = JRequest::getCmd('c');
        if ($c == 'fb') {
           $csuff = 'FB';
           require_once(JPATH_COMPONENT.DS.'controllers'.DS.'facebook.php');
        } else {
          switch ($vparams->mode){
              case 'videoflow':
              require_once(JPATH_COMPONENT.DS.'controllers'.DS.'videoflow.php');
              $csuff = '';
              break; 
          
              default:
              global $mainframe;
              if (empty($vparams->mode)) $link = 'index.php'; else $link = 'index.php?option=com_'.$vparams->mode;
              $mainframe->redirect($link);
              break;
        }
      }  
$classname    = 'VideoflowController'.$csuff;
$controller   = new $classname( );
$controller->execute( JRequest::getVar( 'task' ) );
$controller->redirect();